package com.example.fly.pushdemo.smack.extension;

import org.jivesoftware.smack.packet.PacketExtension;

/**
 * Created by fly on 2017/4/13.
 */

public class GoodsTakeExt implements PacketExtension {

    private String token;
    private int goodsNumber;
    private int count;

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public int getGoodsNumber() {
        return goodsNumber;
    }

    public void setGoodsNumber(int goodsNumber) {
        this.goodsNumber = goodsNumber;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    @Override
    public String getElementName() {
        return "query";
    }

    @Override
    public String getNamespace() {
        return "urn:ltb:device:take";
    }

    @Override
    public String toXML() {
        StringBuilder sb = new StringBuilder();
        sb.append("<");
        sb.append(getElementName());
        sb.append(" xmlns = \"" + getNamespace() + "\"");
        sb.append(">");

        sb.append("<token>");
        sb.append(getToken());
        sb.append("</token>");

        sb.append("<goodsnumber>");
        sb.append(getGoodsNumber());
        sb.append("</goodsnumber>");

        sb.append("<count>");
        sb.append(getCount());
        sb.append("</count>");

        sb.append("</");
        sb.append(getElementName());
        sb.append(">");
        return sb.toString();
    }
}
